<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="c" style="width: 200px;height: 200px;"></div>
    <script>
        // https://blog.csdn.net/qq_44870156/article/details/123735590
        function debounce(fun, time) {
            console.log(1)
            let timer
            return function () {
                console.log(2)
                clearTimeout(timer)
                let args = arguments
                timer = setTimeout(() => {
                    fun.apply(this, args)
                }, time)
            }
        }

        var obj = {
            name: 'rose',
            fn: debounce(function () {
                console.log(3)
                console.log(this.name)
            })
        }

        obj.fn()
        obj.fn()
        obj.fn()
        obj.fn()
        obj.fn()
        obj.fn()



    </script>
</body>

</html>